<?php


use think\helper\Str;
use Phinx\Seed\AbstractSeed;

class User extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run(): void
    {
        $salt = Str::random(8);
            $user = [[
                'username'=>'admin',
                'password'=>md5(md5('123456').$salt),
                'create_time'=>date('Y-m-d H:i:s'),
                'update_time'=>date('Y-m-d H:i:s'),
                'salt'  =>$salt,
                'status'=>1
            ]];
            $posts = $this->table('user');
            $posts->insert($user)
              ->saveData();
    }
}
